#include "sdk.h"
#include <wx/intl.h>

M_Code_Exception::M_Code_Exception( const wxString& msg, const wxString& file, int line ) : Message( msg ), File( file ), Line( line ) {}
M_Code_Exception::~M_Code_Exception() {}

void M_Code_Exception::ShowErrorMessage( bool safe ) {
  wxString gccvers;
  #ifdef __GNUC__
  gccvers.Printf( _T( "gcc %d.%d.%d" ), __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ );
  #endif
  wxString title = _T( "Exception" );
  wxString err;
  err.Printf( _T( "An exception has been raised!\n\n"
                  "The application encountered an error at %s, on line %d.\n"
                  "The error message is:\n\n%s\n\n"
                  " %s, "
                  "build: %s %s)" ),
              File.c_str(), Line, Message.c_str(), gccvers.c_str(),
              _T( __DATE__ ), _T( __TIME__ ) );
  if( safe ) {
    wxSafeShowMessage( title, err );
  } else {
    msging( err, title, wxICON_ERROR );
  }
}
